UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNUyeNgjRdqUGEGwhmi/Wi9CJ1Hl5s3MXFDPoQIk3NY=' 
WHERE 
  key_id = 'd79f4a0cfc7d4d3075dea8611c1919c9ea127b56fe92dceea4cc9df5b0e10246' 
  AND (
    token = 'DNUyeNgjRdqUGEGwhmi/Wi9CJ1Hl5s3MXFDPoQIk3NY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032