UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKm3vyLdMjXgc+EHgzPVGp19KPF+mbxIamHM+DnNW+E=' 
WHERE 
  key_id = '29e80a4aec8112c74afbc961c6f47dd8a035da487d9c49e5033375c5afa5908a' 
  AND (
    token = 'BKm3vyLdMjXgc+EHgzPVGp19KPF+mbxIamHM+DnNW+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051