UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p567s3Fl/dNXnKiPKISCvEf3/DYjXSarhg87M+CcJF4=' 
WHERE 
  key_id = 'cd37a98fd189b18515980ca3b36323cc6ffd82e644eba9e1e2b71144dfcc5e34' 
  AND (
    token = 'p567s3Fl/dNXnKiPKISCvEf3/DYjXSarhg87M+CcJF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034