UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XcyMhlcfXnen2Cx9/ZIk/cRMdPCu8dEeI4Kb5740wWE=' 
WHERE 
  key_id = 'c48bd1a9c140105280f1d8dedede9f3febae15a54fb93a19442ea096df8306c6' 
  AND (
    token = 'XcyMhlcfXnen2Cx9/ZIk/cRMdPCu8dEeI4Kb5740wWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022