UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aljVvLhbAW8R0LvOKJCWa1h2CZ4xsWaqwPcJM7lE4Ds='
WHERE
key_id = '4005438a659b7aea5a8dd93c664a1b587c1689210faa5a6b352dbb51cc20cf5c'
AND (
token = 'aljVvLhbAW8R0LvOKJCWa1h2CZ4xsWaqwPcJM7lE4Ds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)