UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'poT+zuhd7IZg1WpYOEjomElJFl801OnxYjDGc1iYJcU='
WHERE
key_id = '004b12347441a4738dd4eb4415b6ffa652c97816874c9dfab83ecd455ac20887'
AND (
token = 'poT+zuhd7IZg1WpYOEjomElJFl801OnxYjDGc1iYJcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)