UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tTNFR+majtORv5SS6OAD8JQEoZQXlPZkEJjT6xAEImY='
WHERE
key_id = 'ee62f45a84159d55cdfa47efcdaa702059f6f62771f64013ba14ed78d5e01322'
AND (
token = 'tTNFR+majtORv5SS6OAD8JQEoZQXlPZkEJjT6xAEImY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)