UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B5w4g7LgKRBA/pqtjUt/kq4HcVWqJcj9gxSzHHbAZEs='
WHERE
key_id = 'b059e74ad780efdbbdb08b632a2527c69fc715776b116cf56e0c3f5b4acd8ada'
AND (
token = 'B5w4g7LgKRBA/pqtjUt/kq4HcVWqJcj9gxSzHHbAZEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)