UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7k8WtgtpYM+hO3Ha10wi+WPU+Y8MvmT99HnewME/6Y0=' 
WHERE 
  key_id = 'd35c255a92a5e15e9e44231da239f104f179683a24fe2b47aaf90659c15cb432' 
  AND (
    token = '7k8WtgtpYM+hO3Ha10wi+WPU+Y8MvmT99HnewME/6Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030