UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFY+frGIPdcZs9VDeSIizykR+UOZpVXwN0cVbAvsbfQ=' 
WHERE 
  key_id = '8b7806301ae40e18d3673b9cd65e8afba09a6d945848a97f6370919904b75276' 
  AND (
    token = 'CFY+frGIPdcZs9VDeSIizykR+UOZpVXwN0cVbAvsbfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024