UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQu7gTJVM+ew4UtU+1C2KQCwZDzsRPtePJXBFrHacXg='
WHERE
key_id = '8b20867d1427e91527a2bd1d37e398e88d03a311798d733b9c204fe94a969844'
AND (
token = 'hQu7gTJVM+ew4UtU+1C2KQCwZDzsRPtePJXBFrHacXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)