UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YCnKhnC02nuik0c9/585XZs1YzxXb9kCD6WTZf1mtHM='
WHERE
key_id = '22cce00eb2668693070c3e5757c0b4149725741911ae5288df6ee2d1cc00638b'
AND (
token = 'YCnKhnC02nuik0c9/585XZs1YzxXb9kCD6WTZf1mtHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)