UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5t5/wb+8RS/ED5jIV+B4SYfqoPEyLJDKbpyRz3cnJXY=' 
WHERE 
  key_id = '796f8668d57beec432e7674d98aca11df10ab761f9b92d5fd7e9c050b2552ed4' 
  AND (
    token = '5t5/wb+8RS/ED5jIV+B4SYfqoPEyLJDKbpyRz3cnJXY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042