UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6KU1IvVhE+vq2IE2LAAZ7VZwGtnvCYnTG9jX7x3/EH0='
WHERE
key_id = '9d832e3172d44e9ffaf0e0625b7d02274c4248633c65a08186da42fca65d911b'
AND (
token = '6KU1IvVhE+vq2IE2LAAZ7VZwGtnvCYnTG9jX7x3/EH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)