UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S16VCVc0tSGYFwYWUXbW9KKXyads8sb0ixCVmE7lQzU=' 
WHERE 
  key_id = 'f9f006550f0a21c7c3dab3ae7c81e1da9584cead0babe50cde5b3ef59292f9c3' 
  AND (
    token = 'S16VCVc0tSGYFwYWUXbW9KKXyads8sb0ixCVmE7lQzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030