UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQ5bL/K0LqQcJ1kFzZJytoxsD1QgbY24RTGQ0ysGEnU='
WHERE
key_id = '597b8be8ab458dc0ca9e629b9c14b520babbce9ee7e07d09363d0fdb8e9e81b9'
AND (
token = 'tQ5bL/K0LqQcJ1kFzZJytoxsD1QgbY24RTGQ0ysGEnU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)