UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PBXR3g+LyEaBcaMSdXwO6Nuhk8SZNYk5+DoNGUiZu6M=' 
WHERE 
  key_id = 'bee257e5b03366296ba0419eb6fdbfb3f9ff97a4cc687fca66e66bdd5e249ca1' 
  AND (
    token = 'PBXR3g+LyEaBcaMSdXwO6Nuhk8SZNYk5+DoNGUiZu6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047