UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hm+XJbgQ8TCi8rEeXqhcSGvtq0aztQOVDcDmq/dmeNk=' 
WHERE 
  key_id = '4d66fc96c8dd8d643d48768ea1b108fc27982c50abd1a169e8b7c58aa89a2309' 
  AND (
    token = 'Hm+XJbgQ8TCi8rEeXqhcSGvtq0aztQOVDcDmq/dmeNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046