UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4DGfGxBhw7kFnCVKZLDoVt1xKNgLGK8M32tDNAUtX54=' 
WHERE 
  key_id = '347f141887063b5747d50213366fd3d86ee5027347314fe1df0982ea5b47f7db' 
  AND (
    token = '4DGfGxBhw7kFnCVKZLDoVt1xKNgLGK8M32tDNAUtX54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029