UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6quFfvRyJBPG3QHHwEU9Vy0KZemahyBly0nuLm6FwKk='
WHERE
key_id = 'ccb28fb85835cd3ff733e5eb863c1de016d3ad78c4aca8887f6c82df2b9300c6'
AND (
token = '6quFfvRyJBPG3QHHwEU9Vy0KZemahyBly0nuLm6FwKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)