UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6b+kRAA0OoFw0SWSfGQ7CfbTnLp1i63uiLHU4lhqMNQ=' 
WHERE 
  key_id = 'f87488cc526512c19ea3214510160efb00b37ddcef29a93283113bd685c190bc' 
  AND (
    token = '6b+kRAA0OoFw0SWSfGQ7CfbTnLp1i63uiLHU4lhqMNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023