UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'amt19RpanYT49ZTByPTC/beGhuKR3CV6cSSO73hlQvk=' 
WHERE 
  key_id = 'e20b5af986a9faabd8b2c8b82e91f5754bf1e19431ff24c3d2282bef6bd3b77b' 
  AND (
    token = 'amt19RpanYT49ZTByPTC/beGhuKR3CV6cSSO73hlQvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024