UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hdbzeID1QtqBoZr/vEj/svDu734eezDJoCysXAIPHYA='
WHERE
key_id = 'f5e970fe485f59bd61fad91c24a909a6b8e23f516f438898a829a18f2a9018a1'
AND (
token = 'hdbzeID1QtqBoZr/vEj/svDu734eezDJoCysXAIPHYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)