UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W5J2fW8gDug0OMi8c9BIeUEEqppUYKk+sj+UE+h0ai8=' 
WHERE 
  key_id = 'fda49c01cf45247a700dec453c150ca11771ce5aa98df133b9d6dc153a6ed55d' 
  AND (
    token = 'W5J2fW8gDug0OMi8c9BIeUEEqppUYKk+sj+UE+h0ai8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034