UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XS4ST2vRiotLcVD8WOZFA8G3ERqi/HAkPuOOMpGw20g=' 
WHERE 
  key_id = '9b3f9179ff4610fc8497b2eac57a62e90495afb529fc7230cfb42e2349533137' 
  AND (
    token = 'XS4ST2vRiotLcVD8WOZFA8G3ERqi/HAkPuOOMpGw20g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020