UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'izF5lrCYi3VK7LbArXh377JnGmKzT+9LypRnu2jRYC4='
WHERE
key_id = 'a10b7b86e5a9cd283f88f9c45da24f9a3f075feafaf99d347d12f867c9abda2b'
AND (
token = 'izF5lrCYi3VK7LbArXh377JnGmKzT+9LypRnu2jRYC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)