UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwaLzNMlUq0XhD9CrSyBoyvD9rO4xCouPUTIKi3YXPY=' 
WHERE 
  key_id = '9d1b16254ef2eba8901e4a83894c09c0c2058dbe3081b18404f57344983bff99' 
  AND (
    token = 'gwaLzNMlUq0XhD9CrSyBoyvD9rO4xCouPUTIKi3YXPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022