UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TTDJw4lNRZe6ooZQGTVEt2A/Hr+2MzYYnWzJkwCftnI=' 
WHERE 
  key_id = '95358ae9930cb1b72a4e35676bc2c2ccbd71f560e911777bf6904fd2977fe33f' 
  AND (
    token = 'TTDJw4lNRZe6ooZQGTVEt2A/Hr+2MzYYnWzJkwCftnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026