UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afBEiuzZh6d0TerBtR/P99XovnAWmwM130xhSMsYIA4='
WHERE
key_id = '03d82e31ff845964dfc47132837feb8fa08929a8e17286c6bc55bb50045a7ae4'
AND (
token = 'afBEiuzZh6d0TerBtR/P99XovnAWmwM130xhSMsYIA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)