UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O4k0GTPpI1nF7mFbmGeX/BC7lVZ8NitqQxAaPib6pz8=' 
WHERE 
  key_id = '029b8bc43697e8ca7182d7fa7aa760ddfce161fbf8dc05d683e04608c19724ab' 
  AND (
    token = 'O4k0GTPpI1nF7mFbmGeX/BC7lVZ8NitqQxAaPib6pz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044