UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o246aAsUGvoRJlY3FnkeDvl7LptQeKoVXwQIhRib5YI=' 
WHERE 
  key_id = '6b416f201f5ae762950960d2780bbe77c7c181adc2207d3e09953ea1da291eb2' 
  AND (
    token = 'o246aAsUGvoRJlY3FnkeDvl7LptQeKoVXwQIhRib5YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030