UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g2Cm9gNLb2rvMKzIrMtZ0tY4yL9NwEbFuD9cxWpmFNg=' 
WHERE 
  key_id = '0f52838914a00257f0863063183875e9b9c4bf1d482c4ceda2cf7b7e94c91e11' 
  AND (
    token = 'g2Cm9gNLb2rvMKzIrMtZ0tY4yL9NwEbFuD9cxWpmFNg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045