UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ru0i1uFVnkrSZaN8usrXzslyDw0bw3Nr8qTeELD/Otc=' 
WHERE 
  key_id = '8d4d917aac3315101dbacf7306bca55a2718f9f0fac77115be408b063e53cefc' 
  AND (
    token = 'Ru0i1uFVnkrSZaN8usrXzslyDw0bw3Nr8qTeELD/Otc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039