UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8qPkwb9weVtdWlPHCaj5GqlLR9kuy/DyMWccxafV7w='
WHERE
key_id = '41dd02584b6576903274f148878dadc8e11753f58834df45c949c75f1babc2ab'
AND (
token = 'N8qPkwb9weVtdWlPHCaj5GqlLR9kuy/DyMWccxafV7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)