UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kFrgZncVn2bVvQfGjEpnmQMdyQeeE2d5230+R5uheKs=' 
WHERE 
  key_id = 'a7b03c8fb24efa244a3ad3814e686ae4edb83af6066a94acb3af372ad42d1284' 
  AND (
    token = 'kFrgZncVn2bVvQfGjEpnmQMdyQeeE2d5230+R5uheKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033