UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1kUN/R2meXsLt95UQaEDor8K3AMBUWqAoZrPbQVoN8=' 
WHERE 
  key_id = '907ce8e841e906dbe6556b139123da74e01ea96310de17fc3e5cc1e6d883c105' 
  AND (
    token = 'P1kUN/R2meXsLt95UQaEDor8K3AMBUWqAoZrPbQVoN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045