UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kjMD9q9sbvbujnvit+M1nKLxDXi6//+d+DpwggMaLWE=' 
WHERE 
  key_id = 'dd6147060915f08d7198cef521fa540492a7754cfdd18da2b7bd14b6b838c96b' 
  AND (
    token = 'kjMD9q9sbvbujnvit+M1nKLxDXi6//+d+DpwggMaLWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047