UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z18D/Dgy2Xnfycf6ImnY3LhoNQuh9ZaUlO2KxsqGnpM=' 
WHERE 
  key_id = 'e0961a5da886f9c880be7b69475e0881439ac2b3cc50a6ddab3221c92075ba09' 
  AND (
    token = 'Z18D/Dgy2Xnfycf6ImnY3LhoNQuh9ZaUlO2KxsqGnpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023