UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7s2DNXw7EZCUYYGCfL+wzCkL0KP6JkR7Jdnxi2aSg6A=' 
WHERE 
  key_id = '3edd28fbefecff6e916a5eb876001f84051c8dc60a79259c6a0abe4d382e2577' 
  AND (
    token = '7s2DNXw7EZCUYYGCfL+wzCkL0KP6JkR7Jdnxi2aSg6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032