UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xj5caannk96IaFezxAKRHiECgRYstdx6fHeZ/iYcQCM=' 
WHERE 
  key_id = 'a764167a3e534fe532d6e5a07f4a080b080a3ff2604510ca530108aa05248083' 
  AND (
    token = 'Xj5caannk96IaFezxAKRHiECgRYstdx6fHeZ/iYcQCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068