UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XusJ8ByE18W+EeghimyTpEJYkivVsaOYsgoduT7T+z0=' 
WHERE 
  key_id = '70aaf6c453e29a98d8b02bde5e5d3f697e6720046fb58dbfb404c5cec44ec34d' 
  AND (
    token = 'XusJ8ByE18W+EeghimyTpEJYkivVsaOYsgoduT7T+z0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025