UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JlB8g115aWG59S8R+ABgkIpLpdBcVosz8uzviFkansI=' 
WHERE 
  key_id = 'd0f27920eba649fe5a453726443b2c046a00f9c15622c16211d0ab0fab903a1b' 
  AND (
    token = 'JlB8g115aWG59S8R+ABgkIpLpdBcVosz8uzviFkansI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035