UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sTfx6btgGniuigqGhNKlvoz3TkcgyZchr9Hxv9WbxOA=' 
WHERE 
  key_id = 'b97cda9a886c2e887c9c71c85330418b22625c98b20ab945a4276860498c9b0a' 
  AND (
    token = 'sTfx6btgGniuigqGhNKlvoz3TkcgyZchr9Hxv9WbxOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045