UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZW40Cn9SlxtG9L7qiRfY8cDXkpIXqfKIWbJJhLyOpZk='
WHERE
key_id = '86143de4cfc187cca267c42cbef3875c57e98ef0738aed9861c00b962b3f48f0'
AND (
token = 'ZW40Cn9SlxtG9L7qiRfY8cDXkpIXqfKIWbJJhLyOpZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)