UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6V+7xwmjPWsFNaxW7uDiqfLC8l6/CguNETy4Z1CUrQ8=' 
WHERE 
  key_id = '1b85c037370aa32cd13dd5f5ad396ba0d123c3498f0410e917a982b8a3f7e5a3' 
  AND (
    token = '6V+7xwmjPWsFNaxW7uDiqfLC8l6/CguNETy4Z1CUrQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062