UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1eidyd+vCMxYnr39kufMoL/i1qKBLsF5Mr7Gk7LeIOo=' 
WHERE 
  key_id = 'c9627fee634e9cd77eca4ee50b9523bb8f74e8635749dd762b09b339e877a510' 
  AND (
    token = '1eidyd+vCMxYnr39kufMoL/i1qKBLsF5Mr7Gk7LeIOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037