UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WiwXdQRYtC6KshGQdEQcEFL9T5UGoQ3Gl3ANSvJKytY=' 
WHERE 
  key_id = '962f78de860a98c61e04efc0275e792ec94e1b125cb2d9ee0f46ad1c3d08341a' 
  AND (
    token = 'WiwXdQRYtC6KshGQdEQcEFL9T5UGoQ3Gl3ANSvJKytY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041