UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qt37N3xGe9UX4ayXNa9ZtKKhEgB6NAAtgXbMc+Dpm70=' 
WHERE 
  key_id = '2968642f81eea988b98cf74b3c67207ec99770c82af68b9fe6ecb4206ce3a91d' 
  AND (
    token = 'Qt37N3xGe9UX4ayXNa9ZtKKhEgB6NAAtgXbMc+Dpm70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017