UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mTkz8XM+e6axpkiVqwVQ1AgPM5NXpzJ0oMkw+g4KE/8=' 
WHERE 
  key_id = '2380f7d68fe620cafdb1845c005707ea9e0bff342cad9f24f6ce20f4ebf0d457' 
  AND (
    token = 'mTkz8XM+e6axpkiVqwVQ1AgPM5NXpzJ0oMkw+g4KE/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024