UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FaCGjcqn/A0Q2/cI/ICfC9m7y3tHD8GrOLtV8ejyd2M=' 
WHERE 
  key_id = '6579f2b05c18284ad913aeeac84affa3cf439459e66d0364fa9090d8cf9ca52f' 
  AND (
    token = 'FaCGjcqn/A0Q2/cI/ICfC9m7y3tHD8GrOLtV8ejyd2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032