UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tvLLD8OHMnHQG1WcSRz31F443MeNh719/I3KW596SC8='
WHERE
key_id = '6688e0e47e70132cf553175dc59553d7dfb25840afd5ed15800858f1405908a2'
AND (
token = 'tvLLD8OHMnHQG1WcSRz31F443MeNh719/I3KW596SC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)