UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ZaFShlZT7hc99JKFWcylX+hGKvC1b3RdqlR2+ZkC90='
WHERE
key_id = '085a969d6597110df242e2210b4cb63c9f0f715f099e221f094e5cd08d15a196'
AND (
token = '7ZaFShlZT7hc99JKFWcylX+hGKvC1b3RdqlR2+ZkC90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)