UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lh7aDzLNMtc8ATHFKiX5HP8sURP2w9OKLHQhKan+X+Y=' 
WHERE 
  key_id = '4b8c653b5c184f97824de7a84e66fd270ff2a5e5fe286b645eca172f10102063' 
  AND (
    token = 'Lh7aDzLNMtc8ATHFKiX5HP8sURP2w9OKLHQhKan+X+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035