UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ig+jpzoYeOLzA1ReFkBaOdvnV+bbecbxXNrO28UYUgs=' 
WHERE 
  key_id = 'cfa449ff12055fec258c1248ed882864e7f8015db00ff7524da44da03c807978' 
  AND (
    token = 'Ig+jpzoYeOLzA1ReFkBaOdvnV+bbecbxXNrO28UYUgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038