UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ButUzsz9jaVzTmWd+U3JZWLZs+qjLRyammSv5iF4vxM='
WHERE
key_id = 'c1dfb9e8b9c98cea12f735d11d4bafe600b1c2bf6a62bb1c71d84fd7a40ed5f8'
AND (
token = 'ButUzsz9jaVzTmWd+U3JZWLZs+qjLRyammSv5iF4vxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)