UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yy4J6HVR7eby3dyokTk4or0Uy6PCVxvwkULqvQsOEW4=' 
WHERE 
  key_id = '498e5e34a81875528d0f95bb0311ca3c314014e3bbf6006689d33dd734a35243' 
  AND (
    token = 'yy4J6HVR7eby3dyokTk4or0Uy6PCVxvwkULqvQsOEW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030