UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LI9uNd2VMmPJeNA497X8hHBjIvUPxO8+cR6+ol9MnIg='
WHERE
key_id = '4c31d7b8d1ea2766854d6da8880d8ad9daa5f6567a0671a62fe78c34f5f4cfea'
AND (
token = 'LI9uNd2VMmPJeNA497X8hHBjIvUPxO8+cR6+ol9MnIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)