UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XenFk8demM4o2qyBvg1CniZVch0DJzLNb8+ZlcC+3mg='
WHERE
key_id = '46e28af5d53d44807a0381e766b24c648dd4f69c61b82bb07202d76e7eacaba0'
AND (
token = 'XenFk8demM4o2qyBvg1CniZVch0DJzLNb8+ZlcC+3mg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)