UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UJVa8rTVwwR0Qyy/9lsflN/16VZj1vrQ+A2YNb3Dp08=' 
WHERE 
  key_id = '5c8122b0ca165f3da9e002292423fc6df7326ee260c073c46c1b9700dc7f734d' 
  AND (
    token = 'UJVa8rTVwwR0Qyy/9lsflN/16VZj1vrQ+A2YNb3Dp08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022