UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RuZ9gDiAA8poWKtHqiLcWBk+Stml3t+sTvgZLSPxJRY='
WHERE
key_id = 'bf94eef2225618c501e10900efece828b79a6cdc091aa2ca371d32e3c7c5d29d'
AND (
token = 'RuZ9gDiAA8poWKtHqiLcWBk+Stml3t+sTvgZLSPxJRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)