UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msTar8LIpBi5xJNAFfZUqg6vUJP8TWvjvBgHLjGt1+4='
WHERE
key_id = 'a5460a4d248b73b137c4322104fc36847ea45ebbd6826bdf58419fe8f7ec8841'
AND (
token = 'msTar8LIpBi5xJNAFfZUqg6vUJP8TWvjvBgHLjGt1+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)